1 <?
2 include_once(
"fckeditor/fckeditor.php") ;
3 ?>
4 <script src=
"http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
5 <!-- phong to anh-->
6 <script type=
"text/javascript" src="web_files/tooltip.js"></script>
7 <script type=
"text/javascript" src="js/jquery.form.js"></script>
8 <script type=
"text/javascript">
9 $(function() {
10     $(
'.tonus').tooltip({
11         delay:
0,
12         showURL:
false,
13         bodyHandler: function() {
14             
return $("<img/>").attr("src", this.src);
15         }
16     });
17 });
18 </script>
19 <style type=
"text/css">
20     div.thumb {
21         
float:left;
22     }
23     div.caption {
24         padding-left:5px;
25         font-size:10px;
26     }
27     .kich{
28         border: 1px solid #cacaca;
29         padding:2px;
30         width:100px;
31         text-align:center;
32         background-color: #9C9AF9;
33         color:#fff;
34         cursor: pointer;
35         
36     }
37     .rev{
38         border: 1px solid #cacaca;
39         padding:2px;
40         width:100px;
41         text-align:center;
42         background-color: #FF0224;
43         color:#fff;
44         cursor: pointer;
45         
46     }
47     .inner ul
48     {
49     margin:0px;
50     padding:0px;
51     }
52     
53     </style>
54 <!-- script
add them hinh anh-->
55
56 <script>

57 var
ii=1;
58 $(document).ready(function(){
59    $(
'.kich').click(function(){
60     
var insert = '<ul><form id="imageform'+ii+'" method="post" enctype="multipart/form-data" action="ajaxupload.php"><span id="pimg'+ii+'"><input id="xFilePath'+ii+'" type="file" id="photoimg'+ii+'" name="photoimg'+ii+'" /></span></form><div style="float:right" id="preview'+ii+'"></div><span class="rev">Xóa</span></ul>';
61     $(insert).appendTo(
'.inner');
62     ii++;
63    })
64     $(
'.rev').live('click', function() {
65     $(
this).parents('ul').remove();
66    })
67 })
68
69 </script>
70 <script type=
"text/javascript" >
71  $(document).ready(function() {
72             $(
'#photoimg1').change(function(){
73                 $(
"#preview1").html('');
74                 $(
"#preview1").html('<img src="images/loader.gif" alt="Uploading...."/>');
75             $(
"#imageform1").ajaxForm({
76                         target:
'#preview1'
77         }).submit();
78     });
79 });
80 </script>
81 <?
82 $path =
"../images/news";
83 $pathdb =
"images/news";
84 if
(isset($_POST['butSaveLoai'])) {
85     $name=$_POST[
'name'];
86     $
short=$_POST['short'];
87     $desc=$_POST[
'desc'];
88     $cat=$_POST[
'cat'];
89     $thutu = $_POST[
'thutu'];
90     $date=date(
"d-m-Y");
91
92     $catinfo=GetCategoryInfo($categories_id);
93     $err=
"";
94     
if ($name=="") $err .= "Xin nh&#7853;p tên s&#7843;n ph&#7849;m <br>";
95     $err.=CheckUpload($_FILES[
"txtImage"],".jpg;.gif;.png;.bmp",5000*1024,0);
96     $err.=CheckUpload($_FILES[
"txtImageLarge"],".jpg;.gif;.png;.bmp",5000*1024,0);
97
98     
if ($err=='')
99     {
100     
if (!empty($_POST['id'])) {
101             $oldid = $_POST[
'id'];
102             $sql =
"update help set name='".$name."', short='".$short."', content='".$desc."', cat_id='".$cat."', thutu='".$thutu."' where id='".$oldid."'";
103         }
else {
104             $sql =
"insert into help (name, short, content , cat_id, thutu,date) values ('".$name."','".$short."','".$desc."','".$cat."','".$thutu."','".$date."')";
105         }
106         
//echo $sql;
107         
//exit();
108         
if (mysql_query($sql,$con))
109         {
110             
if(empty($_POST['id'])) {
111                 $oldid = mysql_insert_id();
112                 }
113         
114             $sqlUpdateField =
"";
115             
116             $extsmall=GetFileExtention($_FILES[
'txtImage']['name']);
117             
if (MakeUpload($_FILES['txtImage'],"$path/help$oldid$extsmall"))
118             {
119                 @chmod(
"$path/help$oldid$extsmall", 0777);
120                 $sqlUpdateField =
" image='$pathdb/help$oldid$extsmall' ";
121             }
122
123             $extlarge=GetFileExtention($_FILES[
'txtImageLarge']['name']);
124             
if (MakeUpload($_FILES['txtImageLarge'],"$path/news_l$oldid$extlarge"))
125             {
126                 @chmod(
"$path/news_l$oldid$extlarge", 0777);
127                 
if($sqlUpdateField != "") $sqlUpdateField .= ",";
128                 $sqlUpdateField .=
" image_large='$pathdb/news_l$oldid$extlarge' ";
129             }
130             
if($sqlUpdateField!='')
131             {
132                 $sqlUpdate =
"update help set $sqlUpdateField where id='".$oldid."'";
133                 mysql_query($sqlUpdate,$con);
134             }
135         }
136         
else {
137             $err =
"Không th&#7875; c&#7853;p nh&#7853;t";
138         }
139     }
140
141     
if ($err=='') echo '<script>window.location="index.php?act=help&status='.$_REQUEST['status'].'&cat='.$_REQUEST['cat'].'&page='.$_REQUEST['page'].'&code=1"</script>';
142     
else echo "<p align=center class='err'>".$err."</p>";
143 }
else {
144 ?>
145
146 <?
147     
if (isset($_GET['id'])) {
148         $oldid=$_GET[
'id'];
149         $page = $_GET[
'page'];
150         $sql =
"select * from help where id='".$oldid."'";
151         
if ($result = mysql_query($sql,$con)) {
152             $row=mysql_fetch_array($result);
153             $name=$row[
'name'];
154             $image=$row[
'image'];
155             $categories_id = $row[
'cat_id'];
156             $imagelarge=$row[
'image_large'];
157             $
short=$row['short'];
158             $desc=$row[
'content'];
159             $thutu=$row[
'thutu'];
160         }
161     }
162 }
163
164 ?>
165 <form method=
"post" name="FormLoaiSP" enctype="multipart/form-data" action="index.php">
166 <input type=
"hidden" name="act" value="help_m">
167 <input type=
"hidden" name="id" value="<? echo $_REQUEST['id']; ?>">
168 <input type=
"hidden" name="page" value="<? echo $_REQUEST['page']; ?>">
169 <table border=
"1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
170   <tr>
171     <td width=
"45%" class="title" align="center">Thêm m&#7899;i / C&#7853;p nh&#7853;t :
172     Trợ giúp</td>
173   </tr>
174   <tr>
175     <td width=
"45%">
176     <table border=
"0" cellpadding="2" bordercolor="#111111" width="100%" id="AutoNumber2" cellspacing="0">
177 <?

178 if
($image!='')
179 {
180     echo
'<tr><td colspan="3" align="center"><img border="0" src="../'.$image.'"></td></tr>';
181 }
182 ?>
183      <tr>
184         <td width=
"15%" class="smallfont">
185         <p align=
"right">Tên</td>
186         <td width=
"1%" class="smallfont" align="center">
187         <font color=
"#FF0000">*</font></td>
188         <td width=
"83%" class="smallfont">
189         <INPUT
value="<? echo $name; ?>" TYPE="text" NAME="name" CLASS=textbox size="89">
190         </td>
191       </tr>
192
193       <tr>
194         <td width=
"15%" class="smallfont">
195         <p align=
"right">Hình nh&#7887;</td>
196         <td width=
"1%" class="smallfont" align="center">
197         <font color=
"#FF0000">*</font></td>
198         <td width=
"83%" class="smallfont">
199         <INPUT TYPE=
"file" NAME="txtImage" CLASS=textbox size="34"></td>
200       </tr>
201
202       <tr>
203         <td width=
"15%" class="smallfont" align="right">
204         Mô tả ngắn</td>
205         <td width=
"1%" class="smallfont" align="center">
206         &nbsp;</td>
207         <td width=
"83%" class="smallfont">
208 <textarea style=
"width:462; height:99" name="short" cols="4" cols="28"><? echo $short; ?></textarea>
209         </td>
210       </tr>
211
212
213         <tr>
214         <td width=
"15%" class="smallfont" align="right">
215         Mô t&#
7843; s&#7843;n ph&#7849;m</td>
216         <td width=
"1%" class="smallfont" align="center">
217         &nbsp;</td>
218         <td width=
"83%" class="smallfont">
219     <?php
220 $oFCKeditor =
new FCKeditor('desc') ;
221 $oFCKeditor->BasePath =
'fckeditor/' ;
222 $oFCKeditor->Value = $desc ;
223 $oFCKeditor->Create() ;
224 ?>
225             
226         </td>
227       </tr>
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242       <tr>
243         <td width=
"15%" class="smallfont" align="right">
244         Thu&#
7897;c danh m&#7909;c</td>
245         <td width=
"1%" class="smallfont" align="center">&nbsp;
246         </td>
247         <td width=
"83%" class="smallfont">
248         <
select size="1" name="cat" >
249 <?
250         $cats=GetListCatHelp(
0);
251         
foreach ($cats as $cat)
252         {
253             
if ($cat[0]==$categories_id)
254                 echo
"<option value=".$cat[0]." selected>".$cat[1]."</option>";
255             
else
256                 echo
"<option value=".$cat[0].">".$cat[1]."</option>";
257         }
258 ?>
259         </
select>
260         </td>
261       </tr>
262      <tr>
263         <td width=
"15%" class="smallfont" align="right">
264         Th&#
7913; t&#7921; s&#7855;p x&#7871;p</td>
265         <td width=
"1%" class="smallfont" align="right">&nbsp;
266         </td>
267         <td width=
"83%" class="smallfont">
268         <INPUT
value="<? echo $thutu; ?>" TYPE="text" NAME="thutu" CLASS=textbox size="20"></td>
269       </tr>
270       <tr>
271         <td width=
"15%" class="smallfont">
272         <p align=
"right">
273         <INPUT TYPE=
"submit" NAME="butSaveLoai" VALUE="C&#7853;p nh&#7853;t" CLASS=button onclick="submitForm()">&nbsp;</td>
274         <td width=
"1%" class="smallfont" align="center">
275         &nbsp;</td>
276         <td width=
"83%" class="smallfont"><p align="left">&nbsp;<INPUT TYPE="reset" CLASS=button value="Nh&#7853;p l&#7841;i"></td>
277       </tr>
278     </table>
279     </td>
280   </tr>
281   </table>
282 </form>



Full source code website bán hàng thương mại điện tử gần giống shopee 468.889 lượt xem

Gõ tìm kiếm nhanh...